#include "WebsocketClientExample.h"
#include "WLog.h"

WebsocketClientExample::WebsocketClientExample(mg_mgr *mgr)
{
    _websocketClient = new WWebsocketClient(mgr);
    _websocketClient->setListener(this);
}

WebsocketClientExample::~WebsocketClientExample()
{
    delete _websocketClient;
}

bool WebsocketClientExample::connect(const string &websocketServerUrl)
{
    return _websocketClient->connect(websocketServerUrl);
}

bool WebsocketClientExample::sendMsg(const string &msg)
{
    return _websocketClient->sendMsg(msg);
}

void WebsocketClientExample::run()
{
    _websocketClient->run();
}

void WebsocketClientExample::onWsClientReceiveMsg(string &msg)
{
    WLogi() << "WebsocketClientExample::OnWsReceiveMsg msg: " << msg;
}

void WebsocketClientExample::onWsClientConnected()
{
    WLogi() << "WebsocketClientExample::OnWsConnected enter";
}

void WebsocketClientExample::onWsClientClosed()
{
    WLogi() << "WebsocketClientExample::onWsClientClosed enter";
}

void WebsocketClientExample::onWsClientError()
{
    WLogi() << "WebsocketClientExample::onWsClientError enter";
}
